﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Administrator.aspx.cs" Inherits="TwoWheels.Administrator" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
   
    <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
        <asp:TabPanel ID="OrderList" runat="server" HeaderText="Orders in system">
            <ContentTemplate>
                <asp:GridView HorizontalAlign="Center" ID="PendingOrders" runat="server" AutoGenerateColumns="false"
                    CellPadding="10" DataKeyNames="ZamówienieID" DataSourceID="SQLDataConnect2" ForeColor="#333333"
                    GridLines="Both" BorderWidth="1">
                    <Columns>
                        <asp:BoundField DataField="ZamówienieID" HeaderText="Order Number" ReadOnly="True">
                            <ItemStyle Width="300px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Imie" HeaderText="Client" ReadOnly="True">
                            <ItemStyle Width="140px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DataZamówienia" HeaderText="Order Date" ReadOnly="True">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="AdresMiejscaDostarczenia" HeaderText="Deliver to" ReadOnly="True">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                        </asp:BoundField>
                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="SQLDataConnect2" runat="server" ConnectionString="<%$ connectionStrings: ApplicationServices %>"
                    SelectCommand="SELECT [ZamówienieID], [Imie], [DataZamówienia], [AdresMiejscaDostarczenia] FROM [Zamówienie] INNER JOIN [Klienci] ON [Zamówienie].[KlienciKlientID] = [Klienci].[KlientID]">
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:TabPanel>
        <asp:TabPanel ID="AddProducts" runat="server" HeaderText="Add Products">
            <ContentTemplate>
                <p>
                    <asp:Label ID="Label1" Width="150px" runat="server" Text="Product Name" />
                    <asp:TextBox Height="20" ID="ProductName" runat="server" Style="margin-bottom: 0px" />
                </p>
                <p>
                    <asp:Label ID="Label2" Width="150px" runat="server" Text="Category Name" />
                    <asp:TextBox Height="20" ID="CategoryName" runat="server" Style="margin-bottom: 0px" />
                </p>
                <p>
                    <asp:Label ID="Label5" Width="150px" runat="server" Text="Price" />
                    <asp:TextBox Height="20" ID="Price" runat="server" Style="margin-bottom: 0px" />
                </p>
                <p>
                    <asp:Label ID="Label3" Width="150px" runat="server" Text="Quantity" />
                    <asp:TextBox Height="20" ID="Quantity" runat="server" Style="margin-bottom: 0px" />
                </p>
                <p>
                    <asp:Label ID="Label4" Width="150px" runat="server" Text="Path" />
                    <asp:TextBox Height="20" ID="PicturePath" runat="server" Style="margin-bottom: 0px" />
                </p>
                <p>
                    <asp:Button ID="Add" runat="server" OnClick="addProduct_button" Text="Add" />
                </p>
            </ContentTemplate>
        </asp:TabPanel>
        <asp:TabPanel ID="ShowProducts" runat="server" HeaderText="Show Products">
            <ContentTemplate>
                <asp:GridView HorizontalAlign="Center" ID="Products" runat="server" AutoGenerateColumns="false"
                    CellPadding="10" DataKeyNames="ProduktID" DataSourceID="SqlDataSource3" ForeColor="#333333"
                    GridLines="Both" BorderWidth="1">
                    <Columns>
                        <asp:BoundField DataField="ProduktID" HeaderText="Product Number" ReadOnly="True">
                            <ItemStyle Width="300px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NazwaKategorii" HeaderText="Category" ReadOnly="True">
                            <ItemStyle Width="140px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NazwaProduktu" HeaderText="Product Name" ReadOnly="True">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CenaJednostkowa" HeaderText="Price" ReadOnly="True">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ProduktowWMagazynie" HeaderText="Left" ReadOnly="True">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:CommandField DeleteText="Delete Item" 
                            ShowDeleteButton="True"></asp:CommandField>

                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ connectionStrings: ApplicationServices %>"
                    SelectCommand="SELECT [ProduktID], [NazwaKategorii], [NazwaProduktu], [CenaJednostkowa], [ProduktowWMagazynie] FROM [Produkt] INNER JOIN [Kategoria] ON [Produkt].[KategoriaKategoriaID] = [Kategoria].[KategoriaID]"
                    DeleteCommand="DELETE FROM [Produkt] WHERE [ProduktID]=@ProduktID">
                    <DeleteParameters>
                        <asp:Parameter Name="ProduktID" Type="Int32" />
                    </DeleteParameters>
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:TabPanel>
    </asp:TabContainer>
</asp:Content>
